//
//  CZForwardStatusController.swift
//  GZWeibo666
//
//  Created by 123456 on 15/12/2.
//  Copyright © 2015年 itcast. All rights reserved.
//

import UIKit

import SVProgressHUD

class CZForwardStatusController: CZCommentController {

    override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "转发", style: UIBarButtonItemStyle.Plain, target: self, action: "forwardStatus")
        (navigationItem.titleView as! CZCommentTitleView).titleLabel.text = "转发微博"
        messageField.placeholder = "说说分享心得..."
        
    }
    
    /// 转发按钮的点击事件
    func forwardStatus() {
        // POST发送信息
        print("messageField = \(messageField.text!)")
        print("id = \(status?.id)")
        //
        CZNetworkTool.sharedInstance.forwardStatus(messageField.text!, id: status!.id) { (result, error) -> () in
            if result != nil {
                // 评论成功
                print("转发成功")
                SVProgressHUD.showSuccessWithStatus("转发成功", maskType: SVProgressHUDMaskType.Clear)
                self.back()
                
            } else {
                // 评论失败
                print("转发失败 \(error)")
                SVProgressHUD.showErrorWithStatus("转发失败", maskType: SVProgressHUDMaskType.Clear)
            }

        }
    }
    
}
